
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets" template="/template/main.xhtml">

	<ui:define name="body">
		<h:form prependId="false">
			<p:toolbar>
				<p:toolbarGroup align="left">
					<p:commandButton value="#{messages['button.save']}" action="#{tbCalcularServicoMB.insert}"
						rendered="#{!tbCalcularServicoMB.updateMode}" ajax="false"/>
				</p:toolbarGroup>
			</p:toolbar>

			<br />

			<p:fieldset legend="#{messages['tbCalcularServicos.label']}" toggleable="true" toggleSpeed="500">
				<h:panelGrid id="fields" columns="2">

					<p:outputLabel value="#{messages['tbAgenda.label.idCliente']}: " for="idCliente" styleClass="text-input" />
					<p:selectOneMenu id="idCliente" value="#{tbCalcularServicoMB.clienteSelecionado}" converter="tbClienteConverter" required="true" requiredMessage="#{messages['mensagem.campo.null']}">
						<f:selectItems value="#{tbCalcularServicoMB.tbClientes}"/>
					</p:selectOneMenu>

					<p:outputLabel value="#{messages['tbAgenda.label.idServico']}: " for="idServico" styleClass="text-input" />
					<p:selectOneMenu id="idServico" value="#{tbCalcularServicoMB.servicoSelecionado}" converter="tbServicoConverter" required="true" requiredMessage="#{messages['mensagem.campo.null']}">
						<f:selectItems value="#{tbCalcularServicoMB.tbServicos}"/>
					</p:selectOneMenu>
					
					<p:outputLabel value="#{messages['tbFuncionario.label.idFuncionario']}: " for="idFuncionario" styleClass="text-input" />
					<p:selectOneMenu id="idFuncionario" value="#{tbCalcularServicoMB.funcionarioSelecionado}" converter="tbFuncionarioConverter" required="true" requiredMessage="#{messages['mensagem.campo.null']}">
						<f:selectItems value="#{tbCalcularServicoMB.tbFuncionarios}"/>
					</p:selectOneMenu>

				
				</h:panelGrid>
				
			</p:fieldset>
			
			<p:commandButton value="Adicionar Serviço" action="#{tbCalcularServicoMB.addServicoLista()}" ajax="false"/>
			<h:outputText value=" R$ #{tbCalcularServicoMB.vlTotal}"/>
			
			<p:dataTable id="list" var="bean" value="#{tbCalcularServicoMB.listaCalcularServicos}" emptyMessage=" " paginator="false" rows="20">
				<f:facet name="header">#{messages['tbServicos.list.table.title']}</f:facet>
				<p:column>
					<p:commandButton reRender="list" value="Excluir" action="#{tbCalcularServicoMB.removeServicoLista(bean)}" ajax="false"/>
				</p:column>
				<p:column headerText="#{messages['tbAgenda.label.idServico']}">
						<h:outputText value="#{bean.tbServico.nmServico}" />
				</p:column>
				<p:column headerText="#{messages['tbServicos.label.vlServico']}">
						<h:outputText value="#{bean.tbServico.vlServico}" />
				</p:column>
				<p:column headerText="#{messages['tbFuncionario.label.idFuncionario']}">
						<h:outputText value="#{bean.tbFuncionario.nmFuncionario}" />
				</p:column>
			</p:dataTable>

		</h:form>
	</ui:define>
</ui:composition>